<?php
class tagAction extends CommonAction{
    //标签列表页
    function index(){
        dump(I());
    }
    //文档列表页
    function view(){
        $tagname=I('tagname');
        $p=I('p',"1","intval");
        if(!$tagname){
            send_http_status("404");
        }
        $where=array("t.tagname"=>$tagname);
        //tag信息
        $tag=D('CTags')->alias('t')->where($where)->find();
        //分页
        helper("thinkpage");//加载分页类
        $count=D('CTags')->alias("t")->join("inner join __ARCTAG__ a on a.tid=t.id ")->where($where)->count("t.id");
        $page=new Page($count, 30, "", "tag/view/".rawurlencode($tagname));
        $tag['listpage']=$page->show();
        //文档列表
        $list=D('CTags')->page($p.','.$page->listRows)->GetArcList($tagname);
        $tag['p']=$p;
        
        $this->assign("tag",$tag);
        $this->assign("list",$list);
        $this->_display("list_tag");
    }
}
